package purchasedepartment.purchaseorder.view;

import java.awt.Dimension;
import java.awt.Font;

import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JComponent;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JSeparator;
import javax.swing.JTextField;
import javax.swing.SpringLayout;
import javax.swing.SwingConstants;
import javax.swing.JScrollPane;
import javax.swing.JList;
import javax.swing.JTable;
import javax.swing.AbstractListModel;
import javax.swing.table.DefaultTableModel;

public class PurchaseOrderFromIndentView extends JPanel 
{
	private JScrollPane scrollPanePurchaseOrder;
	private JTable table;
	private JTextField tfOrderDate;
	private JButton btnOrderDate;
	private JTextField tfOrderNo;
	private JTextField tfIndentDate;
	private JButton btnIndentDate;
	private JTextField tfIndentNo;
	private JTextField tfQuotationDate;
	private JButton btnQuotationDate;
	private JTextField tfQuotationNo;
	private JSeparator separator2;
	private JComboBox cbProjectName;
	private JComboBox cbPriority;
	private JComboBox cbDestination;
	private JTextField tfContactPerson;
	private JComboBox cbPreparedBy;
	private JTextField tfPaymentTerms;
	private JTextField tfInspection;
	private JComboBox cbPaymentMode;

	public PurchaseOrderFromIndentView()
	{
		SpringLayout springLayout = new SpringLayout();
		setLayout(springLayout);
		
		JLabel lblOrderDate = new JLabel("Order Date :");
		lblOrderDate.setFont(new Font("MS Reference Sans Serif", Font.PLAIN, 12));
		springLayout.putConstraint(SpringLayout.NORTH, lblOrderDate, 10, SpringLayout.NORTH, this);
		springLayout.putConstraint(SpringLayout.WEST, lblOrderDate, 10, SpringLayout.WEST, this);
		add(lblOrderDate);
		
		tfOrderDate = new JTextField();
		tfOrderDate.setFont(new Font("MS Reference Sans Serif", Font.PLAIN, 12));
		springLayout.putConstraint(SpringLayout.NORTH, tfOrderDate, 6, SpringLayout.SOUTH,lblOrderDate);
		springLayout.putConstraint(SpringLayout.WEST, tfOrderDate, 10, SpringLayout.WEST,this);
		add(tfOrderDate);
		tfOrderDate.setColumns(10);
		
		btnOrderDate = new JButton("CL");
		btnOrderDate.setFont(new Font("MS Reference Sans Serif", Font.PLAIN, 12));
		springLayout.putConstraint(SpringLayout.NORTH, btnOrderDate, 0, SpringLayout.NORTH,tfOrderDate);
		springLayout.putConstraint(SpringLayout.WEST, btnOrderDate, 6, SpringLayout.EAST, tfOrderDate);
		add(btnOrderDate);
		
		JLabel lblOrderNo = new JLabel("Order No :");
		lblOrderNo.setFont(new Font("MS Reference Sans Serif", Font.PLAIN, 12));
		springLayout.putConstraint(SpringLayout.NORTH, lblOrderNo, 0, SpringLayout.NORTH, lblOrderDate);
		springLayout.putConstraint(SpringLayout.WEST, lblOrderNo, 20, SpringLayout.EAST, btnOrderDate);
		add(lblOrderNo);
		
		tfOrderNo = new JTextField();
		tfOrderNo.setFont(new Font("MS Reference Sans Serif", Font.PLAIN, 12));
		springLayout.putConstraint(SpringLayout.NORTH, tfOrderNo, 0, SpringLayout.NORTH,tfOrderDate);
		springLayout.putConstraint(SpringLayout.WEST, tfOrderNo, 0, SpringLayout.WEST, lblOrderNo);
		add(tfOrderNo);
		tfOrderNo.setColumns(10);
		
		JLabel lblIndentDate = new JLabel("Indent Date :");
		lblIndentDate.setFont(new Font("MS Reference Sans Serif", Font.PLAIN, 12));
		springLayout.putConstraint(SpringLayout.NORTH, lblIndentDate, 10, SpringLayout.SOUTH, tfOrderDate);
		springLayout.putConstraint(SpringLayout.WEST, lblIndentDate, 0, SpringLayout.WEST, lblOrderDate);
		add(lblIndentDate);
		
		tfIndentDate = new JTextField();
		tfIndentDate.setFont(new Font("MS Reference Sans Serif", Font.PLAIN, 12));
		springLayout.putConstraint(SpringLayout.NORTH, tfIndentDate, 6, SpringLayout.SOUTH, lblIndentDate);
		springLayout.putConstraint(SpringLayout.WEST, tfIndentDate, 10, SpringLayout.WEST, this);
		add(tfIndentDate);
		tfIndentDate.setColumns(10);
		
		btnIndentDate = new JButton("CL");
		btnIndentDate.setFont(new Font("MS Reference Sans Serif", Font.PLAIN, 12));
		springLayout.putConstraint(SpringLayout.NORTH, btnIndentDate, 0, SpringLayout.NORTH,tfIndentDate);
		springLayout.putConstraint(SpringLayout.WEST, btnIndentDate, 6, SpringLayout.EAST, tfIndentDate);
		add(btnIndentDate);
		
		JLabel lblIndentNo = new JLabel("Indent No :");
		lblIndentNo.setFont(new Font("MS Reference Sans Serif", Font.PLAIN, 12));
		springLayout.putConstraint(SpringLayout.NORTH, lblIndentNo, 0, SpringLayout.NORTH, lblIndentDate);
		springLayout.putConstraint(SpringLayout.WEST, lblIndentNo, 20, SpringLayout.EAST, btnIndentDate);
		add(lblIndentNo);
		
		tfIndentNo = new JTextField();
		tfIndentNo.setFont(new Font("MS Reference Sans Serif", Font.PLAIN, 12));
		springLayout.putConstraint(SpringLayout.NORTH, tfIndentNo, 0, SpringLayout.NORTH,tfIndentDate);
		springLayout.putConstraint(SpringLayout.WEST, tfIndentNo, 0, SpringLayout.WEST, lblIndentNo);
		add(tfIndentNo);
		tfIndentNo.setColumns(10);
		
		JLabel lblQuotaionDate = new JLabel("Quotation Date:");
		lblQuotaionDate.setFont(new Font("MS Reference Sans Serif", Font.PLAIN, 12));
		springLayout.putConstraint(SpringLayout.NORTH, lblQuotaionDate, 10, SpringLayout.SOUTH, tfIndentDate);
		springLayout.putConstraint(SpringLayout.WEST, lblQuotaionDate, 10, SpringLayout.WEST, this);
		add(lblQuotaionDate);
		
		tfQuotationDate = new JTextField();
		tfQuotationDate.setFont(new Font("MS Reference Sans Serif", Font.PLAIN, 12));
		springLayout.putConstraint(SpringLayout.NORTH, tfQuotationDate, 6, SpringLayout.SOUTH, lblQuotaionDate);
		springLayout.putConstraint(SpringLayout.WEST, tfQuotationDate, 10, SpringLayout.WEST,this);
		add(tfQuotationDate);
		tfQuotationDate.setColumns(10);
		
		btnQuotationDate = new JButton("CL");
		btnQuotationDate.setFont(new Font("MS Reference Sans Serif", Font.PLAIN, 12));
		springLayout.putConstraint(SpringLayout.NORTH, btnQuotationDate, 0, SpringLayout.NORTH,tfQuotationDate);
		springLayout.putConstraint(SpringLayout.WEST, btnQuotationDate, 6, SpringLayout.EAST, tfQuotationDate);
		
		add(btnQuotationDate);
		
		JLabel lblQuotationNo = new JLabel("Quotation No :");
		lblQuotationNo.setFont(new Font("MS Reference Sans Serif", Font.PLAIN, 12));
		springLayout.putConstraint(SpringLayout.NORTH, lblQuotationNo, 0, SpringLayout.NORTH, lblQuotaionDate);
		springLayout.putConstraint(SpringLayout.WEST, lblQuotationNo, 20, SpringLayout.EAST, btnQuotationDate);
		add(lblQuotationNo);
		
		tfQuotationNo = new JTextField();
		tfQuotationNo.setFont(new Font("MS Reference Sans Serif", Font.PLAIN, 12));
		springLayout.putConstraint(SpringLayout.NORTH, tfQuotationNo, 0, SpringLayout.NORTH,tfQuotationDate);
		springLayout.putConstraint(SpringLayout.WEST, tfQuotationNo, 0, SpringLayout.WEST,lblQuotationNo);
		add(tfQuotationNo);
		tfQuotationNo.setColumns(10);
		
		JSeparator separator1 = new JSeparator();
		springLayout.putConstraint(SpringLayout.NORTH, separator1, 10, SpringLayout.SOUTH, tfQuotationNo);
		springLayout.putConstraint(SpringLayout.WEST, separator1, 10, SpringLayout.WEST, this);
		springLayout.putConstraint(SpringLayout.EAST, separator1, -10, SpringLayout.EAST, this);
		add(separator1);
		
		separator2 = new JSeparator();
		springLayout.putConstraint(SpringLayout.NORTH, separator2, 10, SpringLayout.NORTH, this);
		springLayout.putConstraint(SpringLayout.WEST, separator2, 10, SpringLayout.EAST, tfQuotationNo);
		springLayout.putConstraint(SpringLayout.SOUTH, separator2, -10, SpringLayout.NORTH, separator1);
		springLayout.putConstraint(SpringLayout.EAST, separator2, 12, SpringLayout.EAST, tfQuotationNo);
		separator2.setOrientation(SwingConstants.VERTICAL);
		add(separator2);
		
		JLabel lblProject = new JLabel("Project:");
		springLayout.putConstraint(SpringLayout.NORTH, lblProject, 10, SpringLayout.NORTH,this);
		springLayout.putConstraint(SpringLayout.WEST, lblProject, 10, SpringLayout.WEST,separator2);
		lblProject.setFont(new Font("MS Reference Sans Serif", Font.PLAIN, 12));
		add(lblProject);
		
		cbProjectName = new JComboBox();
		springLayout.putConstraint(SpringLayout.NORTH, cbProjectName, 10, SpringLayout.SOUTH, lblProject);
		springLayout.putConstraint(SpringLayout.WEST, cbProjectName, 10, SpringLayout.WEST,separator2);
		cbProjectName.setFont(new Font("MS Reference Sans Serif", Font.PLAIN, 12));
		cbProjectName.setPreferredSize(new Dimension(200, 20));
		add(cbProjectName);
		
		JLabel lblPriority = new JLabel("Priority:");
		springLayout.putConstraint(SpringLayout.NORTH, lblPriority, 10, SpringLayout.SOUTH,cbProjectName);
		springLayout.putConstraint(SpringLayout.WEST, lblPriority, 10, SpringLayout.EAST,separator2);
		lblPriority.setFont(new Font("MS Reference Sans Serif", Font.PLAIN, 12));
		add(lblPriority);
		
		cbPriority = new JComboBox();
		springLayout.putConstraint(SpringLayout.NORTH, cbPriority, 6, SpringLayout.SOUTH, lblPriority);
		springLayout.putConstraint(SpringLayout.WEST, cbPriority, 10, SpringLayout.EAST,separator2);
		cbPriority.setFont(new Font("MS Reference Sans Serif", Font.PLAIN, 12));
		cbPriority.setPreferredSize(new Dimension(200, 20));
		add(cbPriority);
		
		JLabel lblDestination = new JLabel("Destination:");
		springLayout.putConstraint(SpringLayout.NORTH, lblDestination, 10, SpringLayout.SOUTH,cbPriority);
		springLayout.putConstraint(SpringLayout.WEST, lblDestination, 10, SpringLayout.EAST,separator2);
		lblDestination.setFont(new Font("MS Reference Sans Serif", Font.PLAIN, 12));
		add(lblDestination);
		
		cbDestination = new JComboBox();
		springLayout.putConstraint(SpringLayout.NORTH, cbDestination, 6, SpringLayout.SOUTH,lblDestination);
		springLayout.putConstraint(SpringLayout.WEST, cbDestination, 10, SpringLayout.EAST,separator2);
		cbDestination.setFont(new Font("MS Reference Sans Serif", Font.PLAIN, 12));
		cbDestination.setPreferredSize(new Dimension(200, 20));
		add(cbDestination);
		
		JLabel lblContactPerson = new JLabel("Contact Person:");
		springLayout.putConstraint(SpringLayout.WEST, lblContactPerson,20, SpringLayout.EAST,cbDestination);
		lblContactPerson.setFont(new Font("MS Reference Sans Serif", Font.PLAIN, 12));
		springLayout.putConstraint(SpringLayout.NORTH, lblContactPerson, 10, SpringLayout.NORTH,this);
		add(lblContactPerson);
		
		tfContactPerson = new JTextField();
		tfContactPerson.setFont(new Font("MS Reference Sans Serif", Font.PLAIN, 12));
		springLayout.putConstraint(SpringLayout.NORTH, tfContactPerson, 6, SpringLayout.SOUTH, lblOrderDate);
		springLayout.putConstraint(SpringLayout.WEST, tfContactPerson, 0, SpringLayout.WEST,lblContactPerson);
		add(tfContactPerson);
		tfContactPerson.setColumns(10);
		
		JLabel lblPreparedBy = new JLabel("Prepared By:");
		springLayout.putConstraint(SpringLayout.WEST, lblPreparedBy, 20, SpringLayout.EAST,tfContactPerson);
		lblPreparedBy.setFont(new Font("MS Reference Sans Serif", Font.PLAIN, 12));
		springLayout.putConstraint(SpringLayout.NORTH, lblPreparedBy, 0, SpringLayout.NORTH, lblContactPerson);
		add(lblPreparedBy);
		
		cbPreparedBy = new JComboBox();
		cbPreparedBy.setFont(new Font("MS Reference Sans Serif", Font.PLAIN, 12));
		springLayout.putConstraint(SpringLayout.NORTH, cbPreparedBy, 6, SpringLayout.SOUTH, lblPreparedBy);
		springLayout.putConstraint(SpringLayout.WEST, cbPreparedBy, 0, SpringLayout.WEST, lblPreparedBy);
		cbPreparedBy.setPreferredSize(new Dimension(200, 20));
		add(cbPreparedBy);
		
		JLabel lblCheckedBy = new JLabel("Checked By:");
		springLayout.putConstraint(SpringLayout.WEST, lblCheckedBy, 0, SpringLayout.WEST,lblPreparedBy);
		lblCheckedBy.setFont(new Font("MS Reference Sans Serif", Font.PLAIN, 12));
		springLayout.putConstraint(SpringLayout.NORTH, lblCheckedBy, 10, SpringLayout.SOUTH, cbPreparedBy);
		add(lblCheckedBy);
		
		JComboBox cbCheckedBy = new JComboBox();
		cbCheckedBy.setPreferredSize(new Dimension(200, 20));
		cbCheckedBy.setFont(new Font("MS Reference Sans Serif", Font.PLAIN, 12));
		springLayout.putConstraint(SpringLayout.NORTH, cbCheckedBy, 0, SpringLayout.NORTH, tfIndentDate);
		springLayout.putConstraint(SpringLayout.WEST, cbCheckedBy, 0, SpringLayout.WEST, lblPreparedBy);
		add(cbCheckedBy);
			
		JLabel lblPaymentTerms = new JLabel("Payment Terms:");
		springLayout.putConstraint(SpringLayout.NORTH, lblPaymentTerms, 10, SpringLayout.SOUTH,tfContactPerson);
		lblPaymentTerms.setFont(new Font("MS Reference Sans Serif", Font.PLAIN, 12));
		springLayout.putConstraint(SpringLayout.WEST, lblPaymentTerms, 0, SpringLayout.WEST,lblContactPerson);
		add(lblPaymentTerms);
		
		tfPaymentTerms = new JTextField();
		springLayout.putConstraint(SpringLayout.NORTH, tfPaymentTerms, 6, SpringLayout.SOUTH,lblPaymentTerms);
		tfPaymentTerms.setFont(new Font("MS Reference Sans Serif", Font.PLAIN, 12));
		springLayout.putConstraint(SpringLayout.WEST, tfPaymentTerms, 0, SpringLayout.WEST, lblPaymentTerms);
		add(tfPaymentTerms);
		tfPaymentTerms.setColumns(10);
		
		JLabel lblInspection = new JLabel("Inspection:");
		springLayout.putConstraint(SpringLayout.NORTH, lblInspection, 10, SpringLayout.SOUTH, tfPaymentTerms);
		springLayout.putConstraint(SpringLayout.WEST, lblInspection, 0, SpringLayout.WEST, tfPaymentTerms);
		lblInspection.setFont(new Font("MS Reference Sans Serif", Font.PLAIN, 12));
		add(lblInspection);
		
		tfInspection = new JTextField();
		springLayout.putConstraint(SpringLayout.NORTH, tfInspection, 6, SpringLayout.SOUTH, lblInspection);
		springLayout.putConstraint(SpringLayout.WEST, tfInspection, 0, SpringLayout.WEST, lblInspection);
		tfInspection.setFont(new Font("MS Reference Sans Serif", Font.PLAIN, 12));
		add(tfInspection);
		tfInspection.setColumns(10);
		
		JLabel lblPaymentMode = new JLabel("Payment Mode:");
		springLayout.putConstraint(SpringLayout.NORTH, lblPaymentMode, 10, SpringLayout.SOUTH,cbCheckedBy);
		springLayout.putConstraint(SpringLayout.WEST, lblPaymentMode, 0, SpringLayout.WEST,cbCheckedBy);
		lblPaymentMode.setFont(new Font("MS Reference Sans Serif", Font.PLAIN, 12));
		add(lblPaymentMode);
		
		cbPaymentMode = new JComboBox();
		springLayout.putConstraint(SpringLayout.NORTH, cbPaymentMode, 6, SpringLayout.SOUTH,lblPaymentMode);
		springLayout.putConstraint(SpringLayout.WEST, cbPaymentMode, 0, SpringLayout.WEST,lblPaymentMode);
		cbPaymentMode.setFont(new Font("MS Reference Sans Serif", Font.PLAIN, 12));
		cbPaymentMode.setPreferredSize(new Dimension(200, 20));
		add(cbPaymentMode);
		
		JSeparator separator_1 = new JSeparator();
		springLayout.putConstraint(SpringLayout.NORTH, separator_1, 190, SpringLayout.NORTH, this);
		springLayout.putConstraint(SpringLayout.WEST, separator_1, 10, SpringLayout.WEST, this);
		springLayout.putConstraint(SpringLayout.EAST, separator_1, -10, SpringLayout.EAST, this);
		add(separator_1);
		
		JLabel lblIndent = new JLabel("Indent");
		springLayout.putConstraint(SpringLayout.WEST, lblIndent, 10, SpringLayout.WEST, this);
		lblIndent.setFont(new Font("MS Reference Sans Serif", Font.PLAIN, 12));
		springLayout.putConstraint(SpringLayout.NORTH, lblIndent, 11, SpringLayout.SOUTH, separator_1);
		add(lblIndent);
		
		JComboBox comboBoxIndent = new JComboBox();
		comboBoxIndent.setPreferredSize(new Dimension(200, 20));
		comboBoxIndent.setFont(new Font("MS Reference Sans Serif", Font.PLAIN, 12));
		springLayout.putConstraint(SpringLayout.NORTH, comboBoxIndent, 0, SpringLayout.NORTH, lblIndent);
		springLayout.putConstraint(SpringLayout.WEST, comboBoxIndent, 6, SpringLayout.EAST, lblIndent);
		add(comboBoxIndent);
		
		JButton btnAdd = new JButton("Add");
		btnAdd.setFont(new Font("MS Reference Sans Serif", Font.PLAIN, 12));
		springLayout.putConstraint(SpringLayout.WEST, btnAdd, 10, SpringLayout.WEST,this);
		springLayout.putConstraint(SpringLayout.SOUTH, btnAdd, -10, SpringLayout.SOUTH,this);
		add(btnAdd);
		
		JScrollPane scrollPaneIndentList = new JScrollPane();
		springLayout.putConstraint(SpringLayout.NORTH, scrollPaneIndentList, 10, SpringLayout.SOUTH, lblIndent);
		springLayout.putConstraint(SpringLayout.WEST, scrollPaneIndentList, 10, SpringLayout.WEST, this);
		springLayout.putConstraint(SpringLayout.SOUTH, scrollPaneIndentList, -10, SpringLayout.NORTH,btnAdd);
		springLayout.putConstraint(SpringLayout.EAST, scrollPaneIndentList, -800, SpringLayout.EAST,this);
		add(scrollPaneIndentList);
		
		JScrollPane scrollPanePurchaseOrder =new JScrollPane();
		springLayout.putConstraint(SpringLayout.NORTH, scrollPanePurchaseOrder, 0, SpringLayout.NORTH, scrollPaneIndentList);
		springLayout.putConstraint(SpringLayout.WEST, scrollPanePurchaseOrder, 10, SpringLayout.EAST, scrollPaneIndentList);
		springLayout.putConstraint(SpringLayout.EAST, scrollPanePurchaseOrder, -10, SpringLayout.EAST, this);
		springLayout.putConstraint(SpringLayout.SOUTH, scrollPanePurchaseOrder, 0, SpringLayout.SOUTH, scrollPaneIndentList);
		
		JList list = new JList();
		list.setModel(new AbstractListModel() {
			String[] values = new String[] {"Indent 1", "Indent 2", "Indent 3", "Indent 4"};
			public int getSize() {
				return values.length;
			}
			public Object getElementAt(int index) {
				return values[index];
			}
		});
		scrollPaneIndentList.setViewportView(list);
		add(scrollPanePurchaseOrder);
		
		table = new JTable();
		table.setModel(new DefaultTableModel(
			new Object[][] {
				{null, null, null, null, null, null, null},
			},
			new String[] {
				"New column", "New column", "New column", "New column", "New column", "New column", "New column"
			}
		));
		scrollPanePurchaseOrder.setViewportView(table);
	
	}
}
